package com.wuxiaoge.runner;

import com.wuxiaoge.converter.EntityToVoGenericConverter;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.stereotype.Component;

/**
 * @author lingkang
 * Created by 2023/8/12
 */
@Component
@Order(1) //如果多个自定义的 ApplicationRunner  ，用来标明执行的顺序
public class StartRunAfterInit implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
        DefaultConversionService sharedInstance = (DefaultConversionService) DefaultConversionService.getSharedInstance();
        // 加入我们的解析 FolderEntity → FolderVo
        sharedInstance.addConverter(new EntityToVoGenericConverter());
    }
}

